package ar.com.mooral.pojo;

import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;

import ar.com.mooral.crohn.application.CrohnContext;
import ar.com.mooral.data.DatabaseHelper;

public class BasePojo extends Hashtable<String, String> {

	public BasePojo() {
		super();
		initialize();
	}

	protected void initialize() {
	}

	private DatabaseHelper databaseHelper;
	
	public String getId(){
		return (String)get("id");
	}
	
	public void setDate(String date){
		put("fecha", date);
	}
	
	public String getDate(){
		return (String)get("fecha");
	}
	
	public void setObservations(String observations){
		put("observaciones", observations);
	}
	
	public String getObservations(){
		return (String)get("observaciones");
	}

	public Date getDateObject(){
		Date date = null;
		try{
			SimpleDateFormat formatter = new SimpleDateFormat(CrohnContext.CROHN_FORMAT_DATE);
			
			date = formatter.parse(getDate());
		}catch(Exception e){
			
		}
		return date;
	}
	
	public void setDateObject(Date date){
		try{
			SimpleDateFormat formatter = new SimpleDateFormat(CrohnContext.CROHN_FORMAT_DATE);
			
			setDate(formatter.format(date));
		}catch(Exception e){
			
		}
	}
	
	public void setName(String nombre){
		put("nombre", nombre);
	}
	
	public String getName(){
		return (String)get("nombre");
	}

	public void setDescription(String description){
		put("descripcion", description);
	}
	
	public String getDescription(){
		return (String)get("descripcion");
	}
	
	
	public void setDatabaseHelper(DatabaseHelper databaseHelper) {
		this.databaseHelper = databaseHelper;
	}
	
	public DatabaseHelper getDatabaseHelper() {
		return this.databaseHelper;
	}
	
}
